﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using pwblog.Entities;
using pwblog.BusinessObject;

namespace pwblog.Web
{
    public partial class SearchArticle : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                LoadDataSearch();
            }
        }

        private void LoadDataSearch()
        {
            string key = Request.QueryString["key"];
            //ArticleXml[] articles = new ArticleXmlBo().SearchArticleXml(key);
            Article[] articles = new ArticleBo().SearchArticle(key);
            if (articles != null)
            {
                // hien thi so luong ket qua
                lblResult.Text = articles.Count().ToString();
                // hien thi ket qua
                articleRepeater.DataSource = articles;
                articleRepeater.DataBind();
            }
        }
    }
}